/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.dtd.implementation;

import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author TQD
 */
public class CategoryTableModel extends AbstractTableModel {

    private String header[];
    private ArrayList<String> data;

    public CategoryTableModel() {
        header = new String[]{"COURSE NAME"};
        data = new ArrayList<>();
    }

    @Override
    public int getRowCount() {
        return data.size();
    }

    @Override
    public int getColumnCount() {
        return header.length;
    }
    
    @Override
    public String getColumnName(int columnIndex){
        return header[columnIndex];
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        String courseName = data.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return courseName;
            default:
                return null;
        }

    }
    
    public ArrayList<String> getData(){
        return data;
    }
}
